package org.example.manager.Impl;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import org.example.manager.TrafficTaskManager;
import org.example.mapper.TrafficTaskMapper;
import org.example.model.TrafficTaskDO;

import javax.annotation.Resource;

/**
 * @description:
 * @author: 谢超
 * @date: 2024/11/12 17:14
 */
public class TrafficTaskManagerImpl implements TrafficTaskManager {

    @Resource
    private TrafficTaskMapper trafficTaskMapper;

    @Override
    public int add(TrafficTaskDO trafficTaskDO) {
        return trafficTaskMapper.insert(trafficTaskDO);
    }

    @Override
    public TrafficTaskDO findByIdAndAccountNo(Long id, Long accountNo) {
        return trafficTaskMapper.selectOne(Wrappers.lambdaQuery(TrafficTaskDO.class).eq(TrafficTaskDO::getId, id).eq(TrafficTaskDO::getAccountNo, accountNo));
    }

    @Override
    public int deleteByIdAndAccountNo(Long id, Long accountNo) {
        return trafficTaskMapper.delete(Wrappers.lambdaQuery(TrafficTaskDO.class).eq(TrafficTaskDO::getId, id).eq(TrafficTaskDO::getAccountNo, accountNo));
    }
}
